package cn.zust.edu.cn;
/**
 * 
 * @author czg
 * @since 2023/3/7 10:50
 */
public class Rectangle implements IShape {
    Point ptTopLeft;
    Point ptTopRight;
    int width;
    int height;

    Rectangle() {
        ptTopLeft = new Point();
        ptTopRight = new Point();
        width = 0;
        height = 0;
    }

    Rectangle(Point topleft, int height, int width) {
        ptTopLeft = new Point();
        ptTopRight = new Point();
        this.ptTopLeft = topleft;
        this.height = height;
        this.width = width;
        ptTopRight.x = topleft.x + width;
        ptTopRight.y = topleft.y;
    }

    @Override
    public double perimeter() {
        return 2*(height+width);
    }

    @Override
    public double area() {
        return width * height;
    }

    @Override
    public void draw() {
        System.out.println("Drawing Rectangle");
        System.out.println("perimeter:"+perimeter());
        System.out.println("area:"+area());
    }
}

